package PTA_JAVA.Object.demo2;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        Person[] p=new Person[n];
        for(int i=0;i<n;i++){
            String name=sc.next();
            int age=sc.nextInt();
            boolean gender=sc.nextBoolean();
            p[i]=new Person(name,age,gender);
        }
        for(int i=n-1;i>=0;i--){
            System.out.println(p[i].toString());
        }
        Person p1=new Person();
        System.out.println(p1.toString());
    }
}

class Person {
    private String name;
    private int age;
    private boolean gender;
    private int id;
    private static int valueid=0;


    public Person() {
//        打印"This is constructor"。
//        将name,age,gender,id按照name,age,gender,id格式输出
        System.out.println("This is constructor");
        System.out.println(name+","+age+","+gender+","+id);
    }

    public Person(String name, int age, boolean gender) {
        this.name = name;
        this.age = age;
        this.gender = gender;
    }

    {
        this.id=valueid++;
        System.out.println("This is initialization block, id is "+this.id);
    }
    static {
        System.out.println("This is static initialization block");
    }

    @Override
    public String toString() {
        return "Person [" +
                "name=" + name +
                ", age=" + age +
                ", gender=" + gender +
                ", id=" + id +
                ']';
    }
}

